package com.supconit.ai.utils.oss;

import java.io.IOException;
import java.io.InputStream;
import java.util.HashMap;
import java.util.Map;
import java.util.Properties;

public class ConfigIni {

    private static volatile   Properties properties = null;
    private static volatile ConfigIni configIni = null;

    private ConfigIni() {
        init();
    }

    private void init(){
        properties = new Properties();
        // 设置config.ini文件路径
        String configFilePath = "config.ini";
        try (InputStream inputStream = StsTest.class.getClassLoader().getResourceAsStream(configFilePath)) {
            if (inputStream != null) {
                properties.load(inputStream);
            } else {
                System.out.println("配置文件未找到");
            }
        } catch (IOException e) {
            e.printStackTrace();
            System.out.println("配置文件加载失败");
        }
    }


    public static  Properties getProperties(){
        if(configIni==null){
            synchronized (ConfigIni.class){
                if(configIni==null){
                    configIni = new ConfigIni();
                }
            }
        }
        return properties;
    }

}
